<?php

namespace App\Service;

use App\Library\ChargeCache;

class ConfigService
{
    use ChargeCache;

    /**
     * 配置
     * @param $params
     * @return void
     */
    public function config($params)
    {
        if (isset($params['is_cache'])) {
            $this->delAll();
        }
        //设置缓存
        $this->setKey('vin', $params['vin']);
        $this->setKey('start_charge', $params['start_charge'] ?? 2);
        $this->setKey('stop_charge', $params['stop_charge'] ?? 2);
        $this->setKey('query_start_charge', $params['query_start_charge'] ?? 2);
        $this->setKey('query_stop_charge', $params['query_stop_charge'] ?? 2);
        $this->setKey('notification_charge_order', $params['notification_charge_order'] ?? 1);
    }
}
